using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using DAL;
using Entities;
namespace BUS
{
   public class tbHinhthucttBUS
    {
        public static void Insert(tbHinhthucthanhtoan ht)
        {
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            htDAL.Insert(ht);
        }
        public static void Update(tbHinhthucthanhtoan ht)
        {
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            htDAL.Update(ht);
        }
        public static void Delete(int iD)
        {
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            htDAL.Delete(iD);
        }
        public static tbHinhthucthanhtoanCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            return htDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbHinhthucthanhtoanCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            return htDAL.Get(cri.Criter, 0, 0, tbHinhthucthanhtoanCollumn.mahinhthuctt.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbHinhthucthanhtoan GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbHinhthucthanhtoanCollumn .mahinhthuctt .ToString(), Condition.EQUAL, iD);
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            tbHinhthucthanhtoanCollection htColl = htDAL.Get(cri.Criter, 0, 0, tbHinhthucthanhtoanCollumn.mahinhthuctt.ToString(), OrderDirection.ASC.ToString(), out total);
            if (htColl.Count > 0)
                return htColl[0];
            return null;
        }
        public static tbHinhthucthanhtoanCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            return htDAL.Get(cri.Criter, 1, number,
            tbHinhthucthanhtoanCollumn.mahinhthuctt.ToString(), OrderDirection.DESC.ToString(), out total);
        }
        public static tbHinhthucthanhtoanCollection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbHinhthucttDAL htDAL = new tbHinhthucttDAL();
            return htDAL.Get(cri.Criter, 1, number,
            tbHinhthucthanhtoanCollumn.mahinhthuctt.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
}
